# coding: utf-8
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer

def ContentHTTP():
    text_html = '''<html>

    <h1>Hello World</h1> <br>

    my name is Andru <br>

    <h3>FROM RUSSIA :)</h3>
    <p />

    </html>'''
    return text_html

class handler_class(BaseHTTPRequestHandler):

    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-type','text/html')
        self.end_headers()

        urls = ("menan", "music")

        if self.requestline in http_urls(urls):
            self.wfile.write('ok')
        else:
            self.wfile.write(ContentHTTP())
            print self.requestline

def http_urls(list):
    headers_get1 = u"GET /"
    headers_get2 = u" HTTP/1.1"

    http_urls_list = [headers_get1 + x + headers_get2 for x in list]

    return http_urls_list

def main():
    try:
        server = HTTPServer(('', 80), handler_class)
        print 'started httpserver...'
        server.serve_forever()
    except KeyboardInterrupt:
        print '^C received, shutting down server'
        server.socket.close()

if __name__ == '__main__':
    main()